package com.bms.admin.base.role.service.impl;

import com.bms.admin.base.role.entity.RoleMenu;
import com.bms.admin.base.role.mapper.RoleMenuMapper;
import com.bms.admin.base.role.service.IRoleMenuService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 角色与菜单对应关系 服务实现类
 * </p>
 *
 * @author xj
 * @since 2018-08-09
 */
@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {

	@Autowired
	private RoleMenuMapper roleMenuMapper;

	@Override
	public List<RoleMenu> queryRoleMenuByMenuIds(List<Long> menuIds) {
		return roleMenuMapper.queryRoleMenuByMenuIds(menuIds);
	}

	@Override
	public List<Long> selectMenuIdsByRoleId (Long roleId) {
		return roleMenuMapper.queryMenuIdList(roleId);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public int deleteByRoleIds(List<Long> roleIds) {
		return roleMenuMapper.deleteByRoleIds(roleIds);
	}

}
